package lois;

public class Poisson extends Loi{
	
    private double lambda;
	
    public Poisson(double lambda) {
        this.lambda = lambda;
    }
    
    public int next(){
        int k = 0;
        double p = 1.0;
        double L = Math.exp(-lambda);
        do {
            k++;
            p *= Math.random();
        } while (p >= L);
        return k-1;   
    }    
}